package main

import "fmt"

type Goods struct {
	Name  string
	Price float64
}
type Brand struct {
	Name    string
	address string
}

type TV struct {
	Goods
	Brand
}

type TV2 struct {
	*Goods
	*Brand
}

type Monster struct {
	Name string
	Age  int
}

type E struct {
	Monster
	int
}

func main() {
	tv := TV{Goods{Name: "40cun电视", Price: 520.02}, Brand{"samsung", "山东"}}
	fmt.Println(tv)

	tv2 := TV2{
		&Goods{
			Name:  "100寸",
			Price: 52045,
		},
		&Brand{
			address: "菏泽",
			Name:    "长虹",
		},
	}
	fmt.Println(*tv2.Goods, *tv2.Brand)

	//演示下匿名字段是基本数据类型的使用
	var e E
	e.Name = "hulijing"
	e.Age = 300
	e.int = 20
	fmt.Println(e)
}
